package org.geekbang.bigdata.rpc.protocol;

import org.apache.hadoop.ipc.ProtocolSignature;

import java.io.IOException;

public class MyProtocolImpl implements MyProtocol {
    @Override
    public String findName(long studentId) {
        String id = studentId + "";
        if ("20210000000000".equals(id)) {
            return null;
        }
        if ("20210123456789".equals(id)) {
            return "心心";
        }
        if ("20210735010106".equals(id)) {
            return "时玉超";
        }

        return null;
    }

    @Override
    public long getProtocolVersion(String s, long l) throws IOException {
        return MyProtocol.versionID;
    }

    @Override
    public ProtocolSignature getProtocolSignature(String s, long l, int i) throws IOException {
        return new ProtocolSignature(MyProtocol.versionID, null);
    }
}
